namespace practiceCourse3 {
  function minSubArrayLen(target: number, nums: number[]): number {
    let res = Infinity;
    for (let i = 0; i < nums.length; i++) {
      let sum = 0;
      for (let j = i; j < nums.length; j++) {
        sum += nums[j]
        if (sum >= target) {
          let curLen = j - i + 1;
          res = curLen < res ? curLen : res;
          break;
        }
      }
    }
    return res === Infinity ? 0 : res
  }
}